/* 
 * File:   Event.h
 * Author: Muqtafi Akhmad
 */
#include "../Utilities/boolean.h"
#include "../ADTDateTime/DateTime.h"
#include "../ADTPoint/Point.h"
#include "../ADTCSString/CSString.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef EVENT_H
#define	EVENT_H

#define EVENT_DESCRIPTION_MAX_LENGTH 1024
#define PARTICIPANT_NAME_MAX_LENGTH 32
#define PARTICIPANT_MAX_COUNT 128

/**
 * Definition of Event
 */
typedef struct {
    long entryNo; // entry number
    DateTime dateTime; // date time of event
    Point position; // GPS position
    char description[EVENT_DESCRIPTION_MAX_LENGTH]; // event description
    char **participants; // name of event participants
    short int participantCount; // participant count
} Event;
/**
 * Get entry number of an event
 * @param event the event
 * @return entry number of event
 */
long GetEntryNo(Event event);
/**
 * Get date time of an event
 * @param event the event
 * @return date time of event
 */
DateTime GetDateTime(Event event);
/**
 * Get position of an event
 * @param event the event
 * @return position of event
 */
Point GetPosition(Event event);
/**
 * Get description of an event
 * @param event the event
 * @return description of event
 */
char* GetDescription(Event event);
/**
 * Get participants of an event
 * @param event the event
 * @return participants of event
 */
char** GetParticipants(Event event);
/**
 * Get participant count of an event
 * @param event the event
 * @return participan count of event
 */
short int GetParticipantCount(Event event);

/**
 * Set entry number of an event
 * @param event the event
 * @param entryNo entry number
 */
void SetEntryNo(Event *event, long entryNo);
/**
 * Set date time of an event
 * @param event the event
 * @param dateTime date time
 */
void SetDateTime(Event *event, DateTime dateTime);
/**
 * Set position of an event
 * @param event the event
 * @param position position of event
 */
void SetPosition(Event *event, Point position);
/**
 * Set description of an event
 * @param event the event
 * @param desc description
 */
void SetDescription(Event *event, char* desc);
/**
 * Set participants of an event
 * @param event the event
 * @param participants participants
 * @param participantCount participant count
 */
void SetParticipants(Event *event, char** participants, short int participantCount);
/**
 * Creates an event
 * @param entryNo entry number
 * @param dateTime date time
 * @param venue venue
 * @param desc description 
 * @param participants participants
 * @param participantCount participant count
 * @return event
 */
Event MakeEvent(long entryNo, DateTime dateTime, Point position, char desc[], char** participants, short int participantCount);
/**
 * Returns true if first event is earlier than the second event
 * @param event1 first event
 * @param event2 second event
 * @return event is earlier than
 */
boolean EventLessThan(Event event1, Event event2);
/**
 * Print an event to the stdout
 * @param event event
 */
void PrintEvent(Event event);
/**
 * Dealloc memory used to store participant names
 * @param event the event
 * @param participantCount participant count
 */
void DeallocParticipants(Event* event);
/**
 * Dealloc memory used by event variable
 * @param event the event
 */
void DestroyEvent(Event* event);

/**
 * Event in string format
 * @param event associated event
 * @return string that has information about event
 */
char* EventToString(Event event);
#endif

